#include "cybertron/sensor/noise/TimeNoise.hpp"

CYBERTRON_BEGIN

TimeNoise::TimeNoise(NoiseType noiseType)
	: NoiseBase(noiseType)
{
	resetTime();
}

TimeNoise::~TimeNoise()
{
}

void TimeNoise::resetNoise()
{
	NoiseBase::resetNoise();
	resetTime();
}

double TimeNoise::elapsedTime() const {
	auto timespan = std::chrono::high_resolution_clock::now() - m_initialTime;
	return timespan.count() * 1e-9;
}

void TimeNoise::resetTime()
{
	m_initialTime = std::chrono::high_resolution_clock::now();
}

CYBERTRON_END